package com.atzongmaotan.reggie.common;

/**
 * ClassName:    BaseContext
 * Package:  com.atzongmaotan.common
 * Description:
 *
 * @Author: interface
 * @Create: 2024/6/12 - 下午11:25
 * @Version: v1.0
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    public static void setCurrentUserId(Long userId) {
        threadLocal.set(userId);
    }
    public static Long getCurrentUserId() {
        Long userId = threadLocal.get();
        clearCurrentUserId();
        return userId;
    }
    public static void clearCurrentUserId() {
        threadLocal.remove();
    }
}
